/**
 * 
 */
package com.hera.process.config.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hera.base.util.FiltroDTO;
import com.hera.process.config.dao.DetailParameterDao;
import com.hera.process.config.dao.ParameterDao;
import com.hera.process.config.domain.Parameter;
import com.hera.process.config.service.ParameterService;

/**
 * @author cmontes
 *
 */
@Service("parameterService")
public class ParameterServiceImpl implements ParameterService {

	static final Logger logger = Logger.getLogger(ParameterServiceImpl.class);

	@Autowired
	private ParameterDao parameterDao;
	
	@Autowired
	private DetailParameterDao detailParameterDao;
	/**
	 * 
	 */
	public ParameterServiceImpl() {
		
	}

	/* (non-Javadoc)
	 * @see com.hera.base.service.BaseService#findById(java.io.Serializable)
	 */
	@Override
	public Parameter findById(Long id) {
		
		return parameterDao.findOne(id);
	}

	/* (non-Javadoc)
	 * @see com.hera.base.service.BaseService#update(java.io.Serializable)
	 */
	@Override
	public void update(Parameter entity) {
		
		parameterDao.save(entity);

	}

	/* (non-Javadoc)
	 * @see com.hera.base.service.BaseService#save(java.io.Serializable)
	 */
	@Override
	public void save(Parameter entity) {
		
		parameterDao.save(entity);
	}

	/* (non-Javadoc)
	 * @see com.hera.base.service.BaseService#delete(java.io.Serializable)
	 */
	@Override
	public void delete(Parameter entity) {
		
		detailParameterDao.deleteByParameter(entity.getIdParameter());
		parameterDao.delete(entity);
	}

	/* (non-Javadoc)
	 * @see com.hera.base.service.BaseService#findAll()
	 */
	@Override
	public List<Parameter> findAll() {
		
		return parameterDao.findAll();
	}
	
	@Override
	public List<Parameter> findAll(FiltroDTO filtroDTO) {
		
		return parameterDao.obtenerEntidadesPorFiltros(filtroDTO);
	}

}
